<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" v-model="msg1" style="width: 50px;">
        <select v-model='zifu'>
            <option value="+">+</option>
            <option value="-">-</option>
            <option value="*">*</option>
            <option value="/">/</option>
        </select>
        <input type="text" v-model="msg2" style="width: 50px;">
        <button @click="btnDeng()">=</button>
        <input type="text" v-model="res" style="width: 50px;">
    </div>

    <script>
        let vue = new Vue({
            el: app,
            data() {
                return {
                    msg1: '',
                    zifu: '+',
                    msg2: '',
                    res: ''
                }
            },
            methods: {
                btnDeng() {
                    switch (this.zifu) {
                        case '+':
                            this.res = Number(this.msg1) + Number(this.msg2);
                            break;
                        case '-':
                            this.res = Number(this.msg1) - Number(this.msg2);
                            break;
                        case '*':
                            this.res = Number(this.msg1) * Number(this.msg2);
                            break;
                        case '/':
                            this.res = Number(this.msg1) / Number(this.msg2);
                            break;
                    }
                }
            }
        })
    </script>
</body>

</html>